package me.jiatao.wan.data.database

import androidx.room.TypeConverter
import me.jiatao.wan.data.database.entity.ArticleType

/**
 * @Author: JiaTao
 * @CreateDate: 2021/8/29 10:46
 * @Version: 1.0
 * @Description: Room中类型转换
 */

object RoomTypeConverter {
    @TypeConverter
    @JvmStatic
    fun articleType2Int(type: ArticleType): Int = type.type

    @TypeConverter
    @JvmStatic
    fun int2ArticleType(type: Int): ArticleType =
        ArticleType.values().first { it.type == type }
}